package com.zz.service;

import java.util.Optional;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import com.zz.entity.Warning;
import com.zz.repository.WarningRepository;

@Service
public class WarningService {
	@Resource
	WarningRepository warningRepository;
	public Page<Object[]> showWarninglist(String startpage,String limit){
		Pageable pageable=PageRequest.of(Integer.parseInt(startpage), Integer.parseInt(limit));
		return warningRepository.showWarninglist(pageable);
	}
	public Page<Object[]> showWarninglistByProName(String name,String startpage,String limit){
		Pageable pageable=PageRequest.of(Integer.parseInt(startpage), Integer.parseInt(limit));
		return warningRepository.showWarninglistByProName(name, pageable);
	}
	public Warning savewarning(Warning warning) {
		return warningRepository.save(warning);
	}
	
}
